USE MaryaDB
GO

SELECT t4.Name AS Region, t3.Name AS Administrator, t2.Name AS Store, 
	C.Date, t5.Name AS Type, t6.Name AS State, C.Cost
FROM Contract AS C
INNER JOIN Tree AS t1
ON C.ManagerID = t1.id
INNER JOIN Tree AS t2
ON t1.pid = t2.id
INNER JOIN Tree AS t3
ON t2.pid = t3.id
INNER JOIN Tree AS t4
ON t3.pid = t4.id
INNER JOIN Tree AS t5
ON C.ContractTypeID = t5.id
INNER JOIN Tree AS t6
ON C.ContractStateID = t6.id
WHERE C.Date BETWEEN '01/01/2012' AND '05/31/2012'
